home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS5.ZIP / DOSCOLOR < prev    next >
Text File  |  1986-12-17  |  8KB  |  237 lines

  1.                           EGA at Length
  2.                (PC World July 1986 Star-Dot-Star)
  3.  
  4.      The IBM Enhanced Graphics Adapter is capable of displaying 43
  5. lines of text when used with an Enhanced Color Display or a Monochrome
  6. Display.  However, the IBM-supplied ANSI.SYS device driver does not
  7. handle scrolling properly in the 43-line mode; only the upper 25 lines
  8. of the screen are active.
  9.      The solution is to modify ANSI.SYS to accomodate the additional
  10. lines.  You will also have to modify COMMAND.COM so the CLS command
  11. will work properly.  The steps apply to IBM's DOS 3.10 only; do not
  12. attempt to use them with any other DOS version.
  13.      First make a copy of ANSI.SYS called ANSI43.SYS, make a copy of
  14. COMMAND.COM, and then follow the steps below to perform the patch.
  15. Remember to edit CONFIG.SYS to refer to the ANSI43.SYS driver.
  16.  
  17. A>copy ansi.sys ansi43.sys
  18. A>debug ansi43.sys
  19. -e 29d 90 90
  20. -e 2a1 90 90
  21. -e 27c 2b
  22. -e 283 2a
  23. -e 50c 2b
  24. -e 58f 2b
  25. -w
  26. Writing 0673 bytes
  27. -q
  28.  
  29. A>debug command.com
  30. -e 263b 2a
  31. -w
  32. Writing 0673 bytes
  33. -q
  34.  
  35. -----------------------------------------------------------------
  36.                   The Wonderful World of Color
  37.              (PC World August 1986 The Help Screen)
  38.  
  39.      DOS contains a device driver called ANSI.SYS that can enhance the
  40. PC's rudimentary default screen and keyboard drivers. Once the ANSI.SYS
  41. driver is installed, it accepts commands that control cursor movement
  42. and clear the screen, reassign key definitions, and set screen color.
  43. ANSI.SYS is not, however, a panacea.  While ANSI.SYS can give color to
  44. DOS, many programs, including the BASIC interpreter, bypass installed
  45. screen and keyboard drivers in favor of their own (complete with screen
  46. color choices and key definitions).
  47.      To install ANSI.SYS, copy that file from your DOS disk to the root
  48. directory of the disk you use to start the PC.  With EDLIN or a word
  49. processor that can create ASCII files, edit (or create) the root
  50. directory's CONFIG.SYS file.  Add to the beginning of the file the line
  51. DEVICE=ANSI.SYS.  Note that CONFIG.SYS must reside in the root
  52. directory.  On a hard disk system, however, you can keep ANSI.SYS in
  53. another directory; for example, \DOS.  In that case, assuming the hard
  54. disk is drive C:, the first line of CONFIG.SYS should be:
  55.  
  56. DEVICE=C:\DOS\ANSI.SYS
  57.  
  58.      Save CONFIG.SYS and reboot the PC.  Whenever the PC is started or
  59. reset, DOS looks to the root directory of the system disk to install
  60. the drivers indicated in CONFIG.SYS.
  61.      ANSI.SYS commands consist of an Escape character (ASCII 27)
  62. followed by a short sequence of characters.  When an Escape sequence
  63. is sent to the screen, ANSI.SYS intercepts it.  If the Escape sequence
  64. is a valid ANSI.SYS command, the driver performs the appropriate
  65. function and the command is not displayed.  Escape sequences that are
  66. not ANSI.SYS commands are ignored by the driver and displayed.
  67.      The DOS command PROMPT enables you to modify the DOS prompt to
  68. include Escape and the other characters used in ANSI.SYS commands.
  69. Because those characters are sent to the screen each time the prompt
  70. is displayed, PROMPT is commonly used to command ANSI.SYS. For example,
  71. with the ANSI.SYS driver installed the command:
  72.  
  73. PROMPT $e[1;33m$n$g <Enter>
  74.  
  75. will yield yellow characters.  ($n$g specifies that the name of the
  76. default drive and the greater-than symbol are to be included in the
  77. DOS prompt -- they are not ANSI.SYS commands.  $e specifies the Escape
  78. character, which cannot be entered directly from the keyboard.)
  79.      Of course, remembering the ANSI.SYS code number for a particular
  80. color is difficult.  The batch file COLOR.BAT is a modification of a
  81. listing from "Designer Screens" (PC World November 1985) and eliminates
  82. the need for an elephantine memory or an ANSI.SYS Set Graphics
  83. Rendition (SGR) chart.  Enter and save COLOR.BAT and COLOR.HLP.  With
  84. COLOR.BAT, DOS's screen colors can be set using English.
  85.      The command COLOR NORMAL BLACK BACKCYAN, for example, produces
  86. black characters on a cyan background. The parameter NORMAL is included
  87. first to ensure that the intensity attribute is off -- with intensity
  88. on, the parameter BLACK produces gray characters.
  89.      If COLOR.BAT is called without a subsequent parameter or with the
  90. parameter HELP, the help screen COLOR.HLP is displayed.  It contains
  91. instructions for using COLOR.BAT and lists the batch file's valid
  92. parameters.  Note that COLOR.BAT operates with ECHO off.  When ECHO
  93. is off, the DOS prompt is not displayed; ANSI.SYS commands contained
  94. in the prompt will not be executed until ECHO is turned on and the
  95. prompt is displayed.  COLOR.BAT thus executes an ECHO ON after each
  96. PROMPT/ANSI.SYS command.  Just before ending, COLOR.BAT issues the
  97. command PROMPT $p$g, specifying that the DOS prompt consist of the
  98. current path followed by the greater-than symbol.
  99.  
  100. COLOR.BAT:
  101.  
  102. echo off
  103. cls
  104. echo Please wait ...
  105. if %1.==. goto help
  106. goto %1
  107. :normal
  108. prompt $e[0m
  109. goto exit
  110. :bright
  111. prompt $e[1m
  112. goto exit
  113. :reverse
  114. prompt $e[7m
  115. goto exit
  116. :black
  117. prompt $e[30m
  118. goto exit
  119. :red
  120. prompt $e[31m
  121. goto exit
  122. :green
  123. prompt $e[32m
  124. goto exit
  125. :brown
  126. prompt $e[33m
  127. goto exit
  128. :blue
  129. prompt $e[34m
  130. goto exit
  131. :magenta
  132. prompt $e[35m
  133. goto exit
  134. :cyan
  135. prompt $e[36m
  136. goto exit
  137. :white
  138. prompt $e[37m
  139. goto exit
  140. :backblack
  141. prompt $e[40m
  142. goto exit
  143. :backred
  144. prompt $e[41m
  145. goto exit
  146. :backgreen
  147. prompt $e[42m
  148. goto exit
  149. :backbrown
  150. prompt $e[43m
  151. goto exit
  152. :backblue
  153. prompt $e[44m
  154. goto exit
  155. :backmagenta
  156. prompt $e[45m
  157. goto exit
  158. :backcyan
  159. prompt $e[46m
  160. goto exit
  161. :backwhite
  162. prompt $e[47m
  163. goto exit
  164. :exit
  165. shift
  166. echo on
  167. echo off
  168. cls
  169. echo Please wait ...
  170. if not .==.%1 goto %1
  171. prompt $p$g
  172. goto done
  173. :help
  174. type color.hlp
  175. :done
  176.  
  177. COLOR.HLP
  178.  
  179. ANSI.SYS and CONFIG.SYS (containing
  180.    the line DEVICE=ANSI.SYS) must be
  181.    accessible when the PC is started.
  182. Type COLOR and then your choice(s) of
  183.    character intensity and/or color,
  184.    and/or background color (indicated
  185.    by the prefix `back') selected from
  186.    the following list of parameters.
  187. For color displays:
  188.         black           backblack
  189.         red             backred
  190.         green           backgreen
  191.         brown           backbrown
  192.         blue            backblue
  193.         magenta         backmagenta
  194.         cyan            backcyan
  195.         white           backwhite
  196. Fro color and monochrome displays:
  197.         normal
  198.         bright
  199.         reverse
  200. For example:  COLOR bright red backgreen
  201.  
  202.  
  203.                   COLOR.BAT for DOS 2.xx Users
  204.             (PC World December 1986 The Help Screen)
  205.  
  206.      In the COLOR.BAT file described in PC World August 1986 The Help
  207. Screen (see above), the BACKGREEN parameter produces the "Label not
  208. found" error message.  This is because PC-DOS 2.00, 2.10, and their
  209. MS-DOS cousins do not recognize batch file labels that are more than
  210. 8 characters long (excluding the requisite colon).  DOS 3.00 and 3.10,
  211. on the other hand, simply ignore any label characters after the first
  212. 8 and continue to execute their batch files.  (DOS 1.xx, of course,
  213. does not recognize any batch file labels or GOTO commands.)  That's
  214. why COLOR.BAT, running under DOS 2.xx, cannot GOTO the label :BACKGREEN
  215. -- it's one character too long.
  216.      There are two quick, easy ways to fix COLOR.BAT for DOS 2.xx.
  217. The first is to simply insert a space between the 8th and 9th
  218. characters in a label, thus yielding:
  219.  
  220. :BACKBLAC K
  221. :BACKGREE N
  222. :BACKBROW N
  223. :BACKMAGE NTA
  224. :BACKWHIT E
  225.  
  226.      The contents of the help file, COLOR.HLP, which includes a list
  227. of COLOR.BAT's acceptable parameters, needn't be altered, because you
  228. can use parameters that exceed 8 characters -- DOS will ignore the
  229. excess and locate the appropriate 8-character label.
  230.      The other method uses the letter B instead of BACK as the prefix
  231. for the background color labels.  Thus, BACKMAGENTA becomes BMAGENTA.
  232. The COLOR.BAT file you have can easily be modified by globally
  233. replacing all occurrences of BACK with B using an ASCII word processor.
  234. Remember to do the same to COLOR.HLP's list of parameters but not, of
  235. course, to the word background in the sixth line of COLOR.HLP.
  236.  
  237.